#include "humidity_temperature.h"


Humidity_temperature_INFO Humidity_temperature_info;
Humidity_temperature_INFO Hum_Temp_1830A7D3;
Humidity_temperature_INFO Hum_Temp_1831A7D3;
Humidity_temperature_INFO Hum_Temp_1832A7D3;
Humidity_temperature_INFO Hum_Temp_1833A7D3;
Humidity_temperature_INFO Hum_Temp_1834A7D3;
Humidity_temperature_INFO Hum_Temp_1835A7D3;
Humidity_temperature_INFO Hum_Temp_1836A7D3;
Humidity_temperature_INFO Hum_Temp_1837A7D3;
Humidity_temperature_MA Humidity_temperature_ma;
QStandardItemModel Humidity_temperature_mode_info;


void Humidity_temperature::EQ_0x1830A7D3(quint8 data[])
{
    Hum_Temp_1830A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1830A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1830A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1830A7D3.CAN_count_0x1830A7D3=0;
    Fault_processing_1830A7D3();
}


void Humidity_temperature::EQ_0x1831A7D3(quint8 data[])
{
    Hum_Temp_1831A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1831A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1831A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1831A7D3.CAN_count_0x1831A7D3=0;
    Fault_processing_1831A7D3();
}
void Humidity_temperature::EQ_0x1832A7D3(quint8 data[])
{
    Hum_Temp_1832A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1832A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1832A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1832A7D3.CAN_count_0x1832A7D3=0;
    Fault_processing_1832A7D3();
}
void Humidity_temperature::EQ_0x1833A7D3(quint8 data[])
{
    Hum_Temp_1833A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1833A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1833A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1833A7D3.CAN_count_0x1833A7D3=0;
    Fault_processing_1833A7D3();
}
void Humidity_temperature::EQ_0x1834A7D3(quint8 data[])
{
    Hum_Temp_1834A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1834A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1834A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1834A7D3.CAN_count_0x1834A7D3=0;
    Fault_processing_1834A7D3();
}
void Humidity_temperature::EQ_0x1835A7D3(quint8 data[])
{
    Hum_Temp_1835A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1835A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1835A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1835A7D3.CAN_count_0x1835A7D3=0;
    Fault_processing_1835A7D3();
}
void Humidity_temperature::EQ_0x1836A7D3(quint8 data[])
{
    Hum_Temp_1836A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1836A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1836A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1836A7D3.CAN_count_0x1836A7D3=0;
    Fault_processing_1836A7D3();
}
void Humidity_temperature::EQ_0x1837A7D3(quint8 data[])
{
    Hum_Temp_1837A7D3.TEMP=selffun::com_2uint8(data[1],data[0])*0.1-40;
    Hum_Temp_1837A7D3.Humidity=selffun::com_2uint8(data[3],data[2])*0.1;
    Hum_Temp_1837A7D3.Fault_Sensor=data[4]&1;
    Hum_Temp_1837A7D3.CAN_count_0x1837A7D3=0;
    Fault_processing_1837A7D3();
}
void Humidity_temperature::CAN_loss_rest(int count)
{
    Hum_Temp_1830A7D3.CAN_count_0x1830A7D3++;
    Hum_Temp_1831A7D3.CAN_count_0x1831A7D3++;
    Hum_Temp_1832A7D3.CAN_count_0x1832A7D3++;
    Hum_Temp_1833A7D3.CAN_count_0x1833A7D3++;
    Hum_Temp_1834A7D3.CAN_count_0x1834A7D3++;
    Hum_Temp_1835A7D3.CAN_count_0x1835A7D3++;
    Hum_Temp_1836A7D3.CAN_count_0x1836A7D3++;
    Hum_Temp_1837A7D3.CAN_count_0x1837A7D3++;

    if(Hum_Temp_1830A7D3.CAN_count_0x1830A7D3>count)
    {
        Hum_Temp_1830A7D3.TEMP=0;
        Hum_Temp_1830A7D3.Humidity=0;

    }
    if(Hum_Temp_1831A7D3.CAN_count_0x1831A7D3>count)
    {
        Hum_Temp_1831A7D3.TEMP=0;
        Hum_Temp_1831A7D3.Humidity=0;

    }

    if(Hum_Temp_1832A7D3.CAN_count_0x1832A7D3>count)
    {
        Hum_Temp_1832A7D3.TEMP=0;
        Hum_Temp_1832A7D3.Humidity=0;

    }
    if(Hum_Temp_1833A7D3.CAN_count_0x1833A7D3>count)
    {
        Hum_Temp_1833A7D3.TEMP=0;
        Hum_Temp_1833A7D3.Humidity=0;

    }
    if(Hum_Temp_1834A7D3.CAN_count_0x1834A7D3>count)
    {
        Hum_Temp_1834A7D3.TEMP=0;
        Hum_Temp_1834A7D3.Humidity=0;

    }
    if(Hum_Temp_1835A7D3.CAN_count_0x1835A7D3>count)
    {
        Hum_Temp_1835A7D3.TEMP=0;
        Hum_Temp_1835A7D3.Humidity=0;

    }
    if(Hum_Temp_1836A7D3.CAN_count_0x1836A7D3>count)
    {
        Hum_Temp_1836A7D3.TEMP=0;
        Hum_Temp_1836A7D3.Humidity=0;

    }
    if(Hum_Temp_1837A7D3.CAN_count_0x1837A7D3>count)
    {
        Hum_Temp_1837A7D3.TEMP=0;
        Hum_Temp_1837A7D3.Humidity=0;

    }
}

void Humidity_temperature::rest_data_info()
{

    Hum_Temp_1830A7D3.TEMP=0;
    Hum_Temp_1830A7D3.Humidity=0;
    Hum_Temp_1831A7D3.TEMP=0;
    Hum_Temp_1831A7D3.Humidity=0;
    Hum_Temp_1832A7D3.TEMP=0;
    Hum_Temp_1832A7D3.Humidity=0;
    Hum_Temp_1833A7D3.TEMP=0;
    Hum_Temp_1833A7D3.Humidity=0;
    Hum_Temp_1834A7D3.TEMP=0;
    Hum_Temp_1834A7D3.Humidity=0;
    Hum_Temp_1835A7D3.TEMP=0;
    Hum_Temp_1835A7D3.Humidity=0;
    Hum_Temp_1836A7D3.TEMP=0;
    Hum_Temp_1836A7D3.Humidity=0;
    Hum_Temp_1837A7D3.TEMP=0;
    Hum_Temp_1837A7D3.Humidity=0;
}


void Humidity_temperature::Fault_processing_1830A7D3()
{

    if(Hum_Temp_1830A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1830A7D3.FaultList.indexOf("30温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1830A7D3.FaultList<<"30温湿度传感器故障";}

    }

}
void Humidity_temperature::Fault_processing_1831A7D3()
{

    if(Hum_Temp_1831A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1831A7D3.FaultList.indexOf("31温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1831A7D3.FaultList<<"31温湿度传感器故障";}

    }

}

void Humidity_temperature::Fault_processing_1832A7D3()
{

    if(Hum_Temp_1832A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1832A7D3.FaultList.indexOf("32温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1832A7D3.FaultList<<"32温湿度传感器故障";}

    }

}

void Humidity_temperature::Fault_processing_1833A7D3()
{

    if(Hum_Temp_1833A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1833A7D3.FaultList.indexOf("33温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1833A7D3.FaultList<<"33温湿度传感器故障";}

    }

}

void Humidity_temperature::Fault_processing_1834A7D3()
{

    if(Hum_Temp_1834A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1834A7D3.FaultList.indexOf("34温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1834A7D3.FaultList<<"34温湿度传感器故障";}

    }

}
void Humidity_temperature::Fault_processing_1835A7D3()
{

    if(Hum_Temp_1835A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1835A7D3.FaultList.indexOf("35温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1835A7D3.FaultList<<"35温湿度传感器故障";}

    }

}
void Humidity_temperature::Fault_processing_1836A7D3()
{

    if(Hum_Temp_1836A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1836A7D3.FaultList.indexOf("36温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1836A7D3.FaultList<<"36温湿度传感器故障";}

    }

}
void Humidity_temperature::Fault_processing_1837A7D3()
{

    if(Hum_Temp_1837A7D3.Fault_Sensor==1)
    {
        int index = Hum_Temp_1837A7D3.FaultList.indexOf("37温湿度传感器故障");
        if(index==-1)
        { Hum_Temp_1837A7D3.FaultList<<"37温湿度传感器故障";}

    }

}

void Humidity_temperature::EQ_runinfo()
{
Humidity_temperature_mode_info.setHorizontalHeaderLabels(QStringList()<<QStringLiteral("项目")<<QStringLiteral("数值")<<QStringLiteral("单位"));
Humidity_temperature_mode_info.setItem(0,0,new QStandardItem("1830A7D3温度"));
Humidity_temperature_mode_info.setItem(0,1,new QStandardItem(QString::number(Hum_Temp_1830A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(0,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(1,0,new QStandardItem("1830A7D3湿度"));
Humidity_temperature_mode_info.setItem(1,1,new QStandardItem(QString::number(Hum_Temp_1830A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(1,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(2,0,new QStandardItem("1830A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(2,1,new QStandardItem(QString::number(Hum_Temp_1830A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(2,2,new QStandardItem(""));

Humidity_temperature_mode_info.setItem(3,0,new QStandardItem("1831A7D3温度"));
Humidity_temperature_mode_info.setItem(3,1,new QStandardItem(QString::number(Hum_Temp_1831A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(3,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(4,0,new QStandardItem("1831A7D3湿度"));
Humidity_temperature_mode_info.setItem(4,1,new QStandardItem(QString::number(Hum_Temp_1831A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(4,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(5,0,new QStandardItem("1831A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(5,1,new QStandardItem(QString::number(Hum_Temp_1831A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(5,2,new QStandardItem(""));

Humidity_temperature_mode_info.setItem(6,0,new QStandardItem("1832A7D3温度"));
Humidity_temperature_mode_info.setItem(6,1,new QStandardItem(QString::number(Hum_Temp_1832A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(6,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(7,0,new QStandardItem("1832A7D3湿度"));
Humidity_temperature_mode_info.setItem(7,1,new QStandardItem(QString::number(Hum_Temp_1832A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(7,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(8,0,new QStandardItem("1832A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(8,1,new QStandardItem(QString::number(Hum_Temp_1832A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(8,2,new QStandardItem(""));

Humidity_temperature_mode_info.setItem(9,0,new QStandardItem("1833A7D3温度"));
Humidity_temperature_mode_info.setItem(9,1,new QStandardItem(QString::number(Hum_Temp_1833A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(9,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(10,0,new QStandardItem("1833A7D3湿度"));
Humidity_temperature_mode_info.setItem(10,1,new QStandardItem(QString::number(Hum_Temp_1833A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(10,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(11,0,new QStandardItem("1833A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(11,1,new QStandardItem(QString::number(Hum_Temp_1833A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(11,2,new QStandardItem(""));

Humidity_temperature_mode_info.setItem(12,0,new QStandardItem("1834A7D3温度"));
Humidity_temperature_mode_info.setItem(12,1,new QStandardItem(QString::number(Hum_Temp_1834A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(12,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(13,0,new QStandardItem("1834A7D3湿度"));
Humidity_temperature_mode_info.setItem(13,1,new QStandardItem(QString::number(Hum_Temp_1834A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(13,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(14,0,new QStandardItem("1834A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(14,1,new QStandardItem(QString::number(Hum_Temp_1834A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(14,2,new QStandardItem(""));

Humidity_temperature_mode_info.setItem(15,0,new QStandardItem("1835A7D3温度"));
Humidity_temperature_mode_info.setItem(15,1,new QStandardItem(QString::number(Hum_Temp_1835A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(15,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(16,0,new QStandardItem("1835A7D3湿度"));
Humidity_temperature_mode_info.setItem(16,1,new QStandardItem(QString::number(Hum_Temp_1835A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(16,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(17,0,new QStandardItem("1835A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(17,1,new QStandardItem(QString::number(Hum_Temp_1835A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(17,2,new QStandardItem(""));

Humidity_temperature_mode_info.setItem(18,0,new QStandardItem("1836A7D3温度"));
Humidity_temperature_mode_info.setItem(18,1,new QStandardItem(QString::number(Hum_Temp_1836A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(18,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(19,0,new QStandardItem("1836A7D3湿度"));
Humidity_temperature_mode_info.setItem(19,1,new QStandardItem(QString::number(Hum_Temp_1836A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(19,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(20,0,new QStandardItem("1836A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(20,1,new QStandardItem(QString::number(Hum_Temp_1836A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(20,2,new QStandardItem(""));

Humidity_temperature_mode_info.setItem(21,0,new QStandardItem("1837A7D3温度"));
Humidity_temperature_mode_info.setItem(21,1,new QStandardItem(QString::number(Hum_Temp_1837A7D3.TEMP)));
Humidity_temperature_mode_info.setItem(21,2,new QStandardItem("℃"));
Humidity_temperature_mode_info.setItem(22,0,new QStandardItem("1837A7D3湿度"));
Humidity_temperature_mode_info.setItem(22,1,new QStandardItem(QString::number(Hum_Temp_1837A7D3.Humidity)));
Humidity_temperature_mode_info.setItem(22,2,new QStandardItem("%"));
Humidity_temperature_mode_info.setItem(23,0,new QStandardItem("1837A7D3传感器故障"));
Humidity_temperature_mode_info.setItem(23,1,new QStandardItem(QString::number(Hum_Temp_1837A7D3.Fault_Sensor)));
Humidity_temperature_mode_info.setItem(23,2,new QStandardItem(""));

}
